cast

public abstract CompletableFuture<CastSession> cast(MediaReceiver receiver)

Starts casting the browser content to the media receiver.

In case when the web page has the default PresentationRequest:

const presentationRequest = new PresentationRequest(['receiver/index.html']);
navigator.presentation.defaultRequest = presentationRequest;

the presentation of the media content specified in this request is started instead of casting the browser content. This implies that the receiver should support the presentation as a media source. Otherwise, if there is no default PresentationRequest, the receiver should support any browser's content as a media source.

Returns a new CompletableFuture that is completed when the cast session has been started. If the cast session has not been started, the future is completed with CastSessionStartFailedException. If the browser is closed during the casting start, the future will be canceled.

Since

7.29

See also

Throws

if the browser is closed